import request from '@/utils/request'

// 查询问答点赞列表
export function listQuestionLike(query) {
  return request({
    url: '/zs/questionLike/list',
    method: 'get',
    params: query
  })
}

// 查询问答点赞详细
export function getQuestionLike(zsLikeId) {
  return request({
    url: '/zs/questionLike/' + zsLikeId,
    method: 'get'
  })
}

// 新增问答点赞
export function addQuestionLike(data) {
  return request({
    url: '/zs/questionLike',
    method: 'post',
    data: data
  })
}

// 修改问答点赞
export function updateQuestionLike(data) {
  return request({
    url: '/zs/questionLike',
    method: 'put',
    data: data
  })
}

// 删除问答点赞
export function delQuestionLike(zsLikeId) {
  return request({
    url: '/zs/questionLike/' + zsLikeId,
    method: 'delete'
  })
}

// 前台添加点赞（无需权限）
export function addLike(data) {
  return request({
    url: '/zs/questionLike/addLike',
    method: 'post',
    data: data
  })
}

// 检查是否已点赞
export function checkLike(zsQuestionId, userId) {
  return request({
    url: '/zs/questionLike/check',
    method: 'get',
    params: {
      zsQuestionId,
      userId
    }
  })
}
